# # 1 红色 2：黄 3：绿
# def judge(color):
#     if color == 1 or color == 2:
#         print("司机闯红灯")
#     else:
#         print("司机正常行驶")
#
# judge(1)
# from enum import Enum
#
#
# class TrafficLight(Enum):
#     RED = 1
#     YELLOW = 2
#     GREEN = 3
#
#
# def judge(color):
#     if color == TrafficLight.RED or color == TrafficLight.YELLOW:
#         print("司机闯红灯")
#     else:
#         print("司机正常行驶")
#
# judge(TrafficLight.GREEN)


# 通过名字获取枚举成员
# from enum import Enum
#
#
# class TrafficLight(Enum):
#     RED = 1
#     YELLOW = 2
#     GREEN = 3
#
#
# print(TrafficLight.RED)

# 通过枚举成员获取名字以及值
# from enum import Enum
#
#
# class TrafficLight(Enum):
#     RED = 1
#     YELLOW = 2
#     GREEN = 3
#
#
# # 通过枚举成员获取名字
# print(TrafficLight.RED.name)
# # 通过枚举成员获取值
# print(TrafficLight.RED.value)


# 通过值获取枚举成员
# from enum import Enum
#
#
# class TrafficLight(Enum):
#     RED = 1
#     YELLOW = 2
#     GREEN = 3
#
#
# # 通过枚举成员获取名字
# print(TrafficLight(1))


# from enum import Enum, unique
#
#
# class TrafficLight(Enum):
#     RED = 0
#     RED = 1
#     YELLOW = 2
#     GREEN = 3
#
#
# # 1 红色 2：黄 3：绿
# def judge(color):
#     if color == TrafficLight.YELLOW or color == TrafficLight.RED:
#         print("司机闯红灯")
#     else:
#         print("司机正常行驶")
#
#
# judge(TrafficLight.YELLOW)


# from enum import Enum, unique
#
#
# class TrafficLight(Enum):
#     RED = 1
#     BLACK = 1
#     YELLOW = 2
#     GREEN = 3
#
#
# print(TrafficLight(1))

# from enum import Enum, unique
#
#
# @unique
# class TrafficLight(Enum):
#     RED = 1
#     BLACK = 1
#     YELLOW = 2
#     GREEN = 3
#
#
# print(TrafficLight(1))


from enum import Enum


class TrafficLight(Enum):
    RED = 1
    YELLOW = 2
    GREEN = 3


# 通过名字获取枚举成员
print(TrafficLight.RED == 1)
# 通过枚举成员获取值
print(TrafficLight.RED.value == 1)